$(document).ready(function () {
    $(function () {
        $('[data-toggle="popover"]').popover()
    });

    var sceneWidth = $(window).width();
    var article = $(".article-container");
    var post = $(".post-container");
    var activity = $(".activity-container");

    var currentScene = article;

    $("#menu-article").click(function () {
        if (currentScene !== article) {
            post.css("float", "right");
            currentScene.animate({width: 'toggle'}, 300, function () {
                article.animate({width: 'toggle'}, 300);
                currentScene = article;
            });
        }
    });

    $("#menu-post").click(function () {
        if (currentScene !== post) {
            currentScene.animate({width: 'toggle'}, 300, function () {
                post.animate({width: 'toggle'}, 300);
                currentScene = post;
            });
        }
    });

    $("#menu-activity").click(function () {
        if (currentScene !== activity) {
            post.css("float", "left");
            currentScene.animate({width: 'toggle'}, 300, function () {
                activity.animate({width: 'toggle'}, 300);
                currentScene = activity;
            });
        }
    });

    var clickSum = 1;
    $(".loginMenu").click(function(){
        if(clickSum){
            $(".dropdown-toggle .glyphicon-menu-down").css({
                transition: 'transform 0.2s',
                transform: 'rotate(180deg)'
            });
            $(".dropdown-menu").slideDown("fast");
            clickSum--;
        }else{
            $(".dropdown-toggle .glyphicon-menu-down").css({
                transition: 'transform 0.2s',
                transform: 'rotate(0deg)'
            });
            $(".dropdown-menu").slideUp("fast");
            clickSum++;
        }
    });


    $(document).click(function(){
        if(!clickSum){
            $(".dropdown-toggle .glyphicon-menu-down").css({
                transition: 'transform 0.2s',
                transform: 'rotate(0deg)'
            });
            $(".dropdown-menu").slideUp("fast");
            clickSum++;
        }
    });

});